package components.base
{
	import flash.display.Sprite;
	
	import mx.controls.Tree;
	import mx.controls.listClasses.IListItemRenderer;
	
	[Style(name="selectionBackgroundSkin", type="Class", inherit="no")]
	public class BaseTree extends Tree
	{
		private var img:BaseImage = new BaseImage();
		private var currentY:Number;
		
		public function BaseTree()
		{
			img.width = 194;
			img.height = 25;
			addChild(img);
		}
		
		override public function itemToIcon(item:Object):Class
		{
//			return super.itemToIcon(item);
			return null;
		}
		override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number, 
														   width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void
		{
			super.drawSelectionIndicator(indicator, x, y, 
				width, height, color, itemRenderer);
			indicator.addChild(img);
			img.source = getStyle("selectionBackgroundSkin");
			currentY = y;
		}
		
		override protected function drawHighlightIndicator(indicator:Sprite, x:Number, y:Number, 
														   width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void
		{
			if(y == currentY)return;
			super.drawHighlightIndicator(indicator, x, y, 
				width, height, color, itemRenderer);
		}
	}
}